<%--
  Created by IntelliJ IDEA.
  User: MECHREVO
  Date: 2021/4/9
  Time: 13:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<link href="${pageContext.request.contextPath}/ui/layui/css/layui.css" rel="stylesheet"/>
<script src="${pageContext.request.contextPath}/ui/layui/layui.js"></script>
<style>
    #da{
        height: 100%;
        width: 100%;
        /*background-color: #F9FAFD;*/
        background-color: #F1F3F4;
    }
    .zong{
        width: 970px;
        height: 785px;
        background-color: #FFFFFF;
        border-radius: 10px;
        margin-top: 50px;
        margin-left: 373px;
    }
    .name{
        width: 175px;
        height: 40px;
        /*background-color: #eb7350;*/
        margin-left: 35px;
        font-weight:bold;
        font-size: 25px;
    }
    .type{
        width: 357px;
        height: 40px;
        /*background-color: #eb7350;*/
        margin-left: 60px;
        margin-top: 10px;
    }
    .money{
        width: 120px;
        height: 40px;
        /*background-color: #eb7350;*/
        margin-left: 832px;
        margin-top: -90px;
        font-weight: bold;
        font-size: 25px;
        color: #FF0000;
    }
    .yq{
        width: 230px;
        height: 180px;
        /*background-color: #eb7350;*/
        margin-top: 106px;
        margin-left: 40px;
    }
    .miaoshu{
        width: 330px;
        height: 125px;
        /*background-color: #eb7350;*/
        margin-top: 61px;
        margin-left: 40px;
    }
    .bm{
        width: 825px;
        height: 200px;
        /*background-color: #eb7350;*/
        margin-left: 75px;
    }
    .bmx{
        width: 100px;
        height: 110px;
        background-color: #FFFFFF;
        float: left;
        margin-left: 53px;
    }
</style>
<body>
    <div id="da">
        <div class="box">
            <ul class="layui-nav">
                <li class="layui-nav-item"><a href="">首页</a></li>

                <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/demandhall">需求大厅</a></li>
                <li class="layui-nav-item" style="margin-left: 1532px;">
                    <a href="javascript:;">${userinfo.userName}</a>
                    <dl class="layui-nav-child">
                        <dd><a href="${pageContext.request.contextPath}/updatedanInfo">基本信息</a></dd>
                        <dd><a href="${pageContext.request.contextPath}/anquan">安全管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/mmm">退出</a></li>
            </ul>
        </div>
        <div class="zong">
            <input type="hidden" id="demandid" value="${demand.demandId}">
            <div class="name">
                <span>${demand.demandProjectName}</span>
            </div>
            <div class="type">
                <button type="button" class="layui-btn layui-btn-radius" style="height: 40px;width: 95px;">竞标中</button>
                <button type="button" class="layui-btn layui-btn-radius" style="height: 40px;width: 95px;">项目</button>
                <button type="button" class="layui-btn layui-btn-radius" style="height: 40px;width: 95px;">${demand.projectTypeName}</button>
            </div>
            <div class="money">
                ￥${demand.budgetAmount}
            </div>
            <div class="yq">
                <span>发布日期：${demand.createTime}</span>
                <br>
                <br>
                <span>
                    项目周期： ${demand.duration}&nbsp&nbsp<c:if test="${demand.durationUnit =='m'}">月</c:if>
                                                        <c:if test="${demand.durationUnit =='d'}">天</c:if>
                </span>
                <br>
                <br>
                <span>
                    驻场需求：
                    <c:if test="${demand.onesite =='1'}">
                        无需驻场
                    </c:if>
                    <c:if test="${demand.onesite =='2'}" >
                        偶尔到场交流
                    </c:if>
                    <c:if test="${demand.onesite =='3'}">
                        定期驻场
                    </c:if>
                    <c:if test="${demand.onesite =='4'}">
                        全程驻场
                    </c:if>
                </span>
                <br>
                <br>
                <span>技能要求： ${demand.technicalName}</span>
                <br>
                <br>
                <span>地域要求：${demand.province}</span>
            </div>
            <div class="miaoshu">
                <span>项目需求：${demand.demandProjectDescribe}</span>
            </div>
            <div class="layui-btn-container">
                <input type="hidden" value="${pageContext.request.contextPath}" id="contextPath">
                <%--<button type="button" class="layui-btn layui-btn-radius" style="height: 60px;width: 160px; margin-left: 760px;margin-top: -55px" id="jingb">竞标报名</button>--%>
                <input type="button" class="layui-btn layui-btn-radius" style="height: 60px;width: 160px; margin-left: 760px;margin-top: -55px" id="jingb" value="竞标报名">

            </div>
            <div>
                <span>报名列表</span>
                <div class="bm" id="bm">
                    <c:forEach items="${demandApplies}" var="demandApplies">
                    <div class="bmx">
                        <img src="/img/5963d42dd88f4120ada255fd91ac8a6b.jpg" style="width: 85px; height: 85px;">
                        <span style="margin-left: 28px;">${demandApplies.userName}</span>
                    </div>
                    </c:forEach>
                </div>
            </div>

        </div>

    </div>
</body>
<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>
<script type="text/javascript">
    layui.use('form',function () {
        var form = layui.form;
        $("#jingb").click(function () {
            /*layer.msg("弹框");
            alert($(this).val())*/

            var demandid = $("#demandid").val();
            alert(demandid);
            var url = $("#contextPath").val() + "/apply/applyadd";
            alert(url);
            $.ajax({
                type: "post",
                url: url,
                data:JSON.stringify({
                    "demandId":demandid
                }),
                dataType: "json",
                async: true,
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                    var element = '';
                    for (var i = 0; i < data.length; i++) {
                        element += "<div class=\"bmx\">\n" +
                            "                        <img src=\"/img/5963d42dd88f4120ada255fd91ac8a6b.jpg\" style=\"width: 85px; height: 85px;\">\n" +
                            "                        <span style=\"margin-left: 28px;\">"+data.userinfo.userName+"</span>\n" +
                            "                    </div>"
                    }

                    $("#bm").html(element);
                    /*$("#homecities").html(element);*/
                    form.render('select');
                },

            });
            console.log("success")

        });
    })

</script>
</html>
